<?php
// Filename: /module/Blog/src/Blog/Service/PostService.php
namespace Blog\Service;

use Blog\Model\Post;
use Blog\Model\PostInterface;
use Blog\Mapper\PostMapperInterface;

class PostService implements PostServiceInterface {
	/**
	 *
	 * @var \Blog\Mapper\PostMapperInterface
	 */
	protected $postMapper;
	
	/**
	 *
	 * @param PostMapperInterface $postMapper        	
	 */
	public function __construct(PostMapperInterface $postMapper) {
		$this->postMapper = $postMapper;
	}
	
	/**
	 * {@inheritDoc}
	 */
	public function findAllPosts() {
		return $this->postMapper->findAll ();
	}
	
	/**
	 * {@inheritDoc}
	 */
	public function findPost($id) {
		return $this->postMapper->find ( $id );
	}
	
	/**
	 * {@inheritDoc}
	 */
	public function savePost(PostInterface $post) {
		return $this->postMapper->save ( $post );
	}
	
	/**
	 * {@inheritDoc}
	 */
	public function deletePost(PostInterface $post) {
		return $this->postMapper->delete ( $post );
	}
}